﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Documents;
using System.Windows.Media;
using Kokomo.Environment.Documents;

namespace Kokomo.PeInspector.Reflection
{
	class FlowDocumentViewModel : FlowDocumentViewModelBase
	{
		public FlowDocumentViewModel(
			Action<FlowDocument> documentBuilderDelegate,
			NavigationContext navigationContext,
			string title
			)
			: base(navigationContext, title)
		{
			if (documentBuilderDelegate == null) throw new ArgumentNullException("documentBuilderDelegate");

			this.DocumentBuilderDelegate = documentBuilderDelegate;
		}

		public Action<FlowDocument> DocumentBuilderDelegate { get; private set; }

		protected override FlowDocument CreateSourceDocument()
		{
			FlowDocument document = base.CreateSourceDocument();
			document.FontFamily = new FontFamily("Tahoma");

			return document;
		}

		protected override void BuildDocumentAsync(FlowDocument document)
		{
			this.DocumentBuilderDelegate(document);
		}
	}
}
